const Mock = require("mockjs");
const Random = Mock.Random;
const Dictionary = {
  companyName: ["国贸医疗大数据公司", "人行公司", "厦大小小科技", "巨大农业"],
  expirationDate: ["1年", "6个月", "30天"],
  mockType: ["按钮", "模块", "功能", "栏目"],
  mockSource: ["本系统", "内部链接", "外部链接", "第三方对接"],
  mockStatus: ["abled", "disabled"],
  mockTags: ["长期合作", "心血管重点", "糖尿病重点", "即将到期"]
};

/* 服务项列表 */
const cardList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "no": Random.id(),
      "name": Random.cword(2, 5),
      "status": Random.pick(Dictionary.mockStatus),
      "expirationDate": Random.pick(Dictionary.expirationDate),
      "startDate": Random.datetime("yyyy-MM"),
      "endDate": Random.datetime("yyyy-MM"),
      "usedBy": Random.pick(Dictionary.companyName),
      "price": Random.integer(0, 2000),
      "triggerRule": [],
      "description": Random.csentence(5, 20)
    };
    list.push(obj);
  }
  return {
    success: true,
    data: {
      records: list
    }
  };
};
Mock.mock("/mock/getCardList", cardList);
